import {
  antvg6Add,
  antvg6Id,
  getUserSubsys
} from '@/api/antv/index'
const app = {
  mutations: {
    SET_NAVARR: (state, arr) => {
      state.navArr = arr
    },
  },
  actions: {
    // 新增流程图
    Antvg6Add({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        antvg6Add(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    // 新增流程图id
    Antvg6Id({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        antvg6Id(postselectinfo).then(response => {
          resolve(response.data)
        }).catch(error => {
          reject(error)
        })
      })
    },
    GetUserSubsys({ commit }, postselectinfo) {
      return new Promise((resolve, reject) => {
        getUserSubsys(postselectinfo).then(response => {
          resolve(response.data)
          commit('SET_NAVARR', response.data.data)
        }).catch(error => {
          reject(error)
        })
      })
    }

  }
}

export default app
